package com.hunan.api.catv.action.activition;

import com.hunan.api.catv.action.BaseAction;
import com.hunan.api.catv.annotation.MemberAuth;
import com.hunan.api.catv.common.Api;
import com.hunan.api.catv.entity.Result;
import com.hunan.api.catv.service.biz.activition.ActivationBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author jiang zhuan
 * @version 1.0
 * @description 描述
 * @date 2021/9/8 0008
 * @package com.hunan.api.catv.action.activition
 * @company 湖南有线
 */
@RestController
@RequestMapping(Api.activation)
public class ActivationAction extends BaseAction {
    @Autowired
    ActivationBiz activationBiz;

    @MemberAuth
    @GetMapping("/verification/{type}-{code}")
    public Result verification(HttpServletRequest request, @PathVariable Integer type, @PathVariable String code) {
        String remoteIp = getRemoteIp(request);
        log.info("验证码接口：{}-{}-{}", remoteIp, type, code);
        return buildOK(activationBiz.verfication(getMemberId(request), type, code), "");
    }

}
